package com.hippo.core.ui.components

import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import com.hippo.core.core.ext.click

@Composable
fun StateImageButton(
    checkedImageRes: Int,
    defaultImageRes: Int,
    checked: Boolean = false,
    modifier: Modifier = Modifier,
    onClick: (() -> Unit)? = null
) {

    Image(
        painter = painterResource(id = if (checked) checkedImageRes else defaultImageRes),
        contentDescription = null,
        modifier = modifier.click {
            onClick?.invoke()
        }
    )

}